<html>
<head><meta charset="utf-8"><title>packed UB error · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed.20UB.20error.html">packed UB error</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="148773026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed%20UB%20error/near/148773026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed.20UB.20error.html#148773026">(Nov 29 2018 at 08:43)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> I read your comment <a href="https://github.com/rust-lang/rfcs/pull/2582#discussion_r237383311" target="_blank" title="https://github.com/rust-lang/rfcs/pull/2582#discussion_r237383311">https://github.com/rust-lang/rfcs/pull/2582#discussion_r237383311</a> but it is still not clear to me. </p>
<p>The RFC adds a migration path for people using <code>repr(packed)</code> today, does the RFC also turns this warning into an error?</p>
<p>I think that when the hole thing is over we should write a post-mortem about <code>repr(packed)</code> because what has happened is pretty much an example of how not to deal with an <code>I-Unsound</code> bug IMO.</p>



<a name="148773639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed%20UB%20error/near/148773639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed.20UB.20error.html#148773639">(Nov 29 2018 at 08:57)</a>:</h4>
<blockquote>
<p>does the RFC also turns this warning into an error?</p>
</blockquote>
<p>No, I wanted to keep the RFC focused on the "create raw ref" operation. But if people think that makes more sense, I'd be happy to extend it to also finalize our story around errors/lints for references to packed fields.</p>



<a name="148774753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed%20UB%20error/near/148774753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed.20UB.20error.html#148774753">(Nov 29 2018 at 09:23)</a>:</h4>
<p>So I agree with that. Turning those into errors is an orthogonal problems, one has to figure a time line, and none of that is relevant to the RFC.</p>



<a name="148774807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed%20UB%20error/near/148774807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed.20UB.20error.html#148774807">(Nov 29 2018 at 09:24)</a>:</h4>
<p>It was a bit unclear to me from the wording, because it appeared that the RFC does make this an error for <code>unsafe</code> code.</p>



<a name="148774887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed%20UB%20error/near/148774887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/packed.20UB.20error.html#148774887">(Nov 29 2018 at 09:26)</a>:</h4>
<p>You can resolve my comment, I don't need the text to be amended with any clarification: your word is enough, and I trust that you don't want to turn the RFC discussion into a discussion about how to phase these errors in.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>